<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎注册 - 微商来 - 让更多的人帮你卖货！</title>
    <meta name="description" content="微商来,微信三级分销系统,微信分销系统,注册">
    <meta name="keywords" content="注册,微商来">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="layoutmode" content="standard">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="renderer" content="webkit">
    <meta name="applicable-device" content="mobile">
    <meta name="wap-font-scale" content="no">
    <meta content="telephone=no" name="format-detection">
    <meta http-equiv="Pragma" content="no-cache">

    <link rel="stylesheet" href="PLATFORM_NEW_CSS/loginMobile.css">

    <script type="text/javascript" src="PLATFORM_NEW_JS/jquery.min.js"></script>

</head>

<body>
    <header class="head">
        <div class="top flex_box jc_sb">
            <!--<a href="tel:400-889-6625" class="top-icon top-tel"></a>
            <a href="javascript:;" class="top-icon top-nav"></a>-->
            <div class="h_logo "><img src="http://m.vslai.com/statics/images/mobile/common/h_logo.png" onerror=""></div>
            <div class="h_menu ">
                <div class="h_menu_btn flex_box">
                    <a href="tel:400-889-6625" class="top-icon top-tel"></a>
                    <!--<a href="javascript:;" class="top-icon top-nav "></a>-->
                </div>
            
            </div>
        </div>
    </header>
    <div class="res_page">
            <h1>欢迎注册微商来分销平台</h1>
            <form>
                <div class="register_box">
                    <div class="register_center">
                        <input name="token" id="fromToken" value="3feabfdb" type="hidden">
                                                                            <div class="register_infor">
                                    <span class="left_tt" style="letter-spacing: 4px;">手机号码</span>
                                    <input class="input" type="text" name="mobile" id="mobile" placeholder="重要！账户出现问题时及时联系您 ">
                                </div>
                                                        <div class="register_infor">
                                    <span class="left_tt" style="letter-spacing: 4px;">真实姓名</span>
                                    <input class="input" type="text" name="realname" id="realname" placeholder="方便我们技术人员联系您 ">
                                </div>
                                                                    <div class="register_infor">
                            <span class="left_tt password_bp">设 置 密 码</span>
                            <input type="password" class="input" id="password" name="password" placeholder="密码长度为6-20个字符" autocomplete="new-password">
                        </div>
                        <!--<div class="register_infor">
                            <span class="left_tt telcoe_bp">图形验证码</span>
                            <input type="type" placeholder="请输入图形验证码" class="input min" id="validateCode" name="validateCode"><a class="setpwd_but" href="javascript:;"><img src="http://shop.vslai1.cn/web/index.php?c=utility&amp;a=code" style="cursor:pointer;width: 95px;" onclick="this.src='http://shop.vslai1.cn/web/index.php?c=utility&amp;a=code&amp;' + Math.random();" onerror=""></a>
                        </div>-->
						<div class="register_infor">
                            <span class="left_tt telcoe_bp">图形验证码</span>
                            <input type="type" placeholder="请输入图形验证码" class="input min" id="captcha" name="captcha">
							<img src="{:__URL('PLATFORM_MAIN/login/captcha')}" class="setpwd_but" onclick="this.src='{:__URL('PLATFORM_MAIN/login/captcha')}&' + Math.random();" style="width:88px;padding:0">
                        </div>
                        <div class="register_infor">
                            <span class="left_tt telcoe_bp">手机验证码</span>
                            <input type="type" placeholder="请输入手机验证码" class="input min" id="telcoe" name="telcoe"><button type="button" class="setpwd_but" id="getPhoneCode">获取验证码</button>
                        </div>
                    </div>
                    <div class="register_but"><a href="javascript:;" id="submit">确定提交</a></div>
                </div>
            </form>
            <footer class="res_copyright">
                <p>All Right Reserved ©2017 版权所有</p>
                <p>广州领客信息科技股份有限公司</p>
            </footer>
    </div>
    <div class="all_r">
        <a class="" style="display: none;"></a>
        <a class="back" href="javascript:history.back(-1);"></a>
    </div>

<script>

    // pc端移动端判断
    (function () {
        var url = location.href;
        // replace www.test.com with your domain
        if (!navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)) {
            // location.href = "{:__URL('PLATFORM_MAIN/login/registermobile')}";
            location.href = "{:__URL('PLATFORM_MAIN/login/register')}";
        }
    })();

// alert提示语优化
function showMsg(text,position){
	var show	=	$('.show_msg').length
	if(show>0){
		
	}else{
		var	div		=	 $('<div></div>');
			div.addClass('show_msg');
		var span	=	$('<span></span>');
			span.addClass('show_span');
			span.appendTo(div);
			span.text(text);
		$('body').append(div);
	}
	$(".show_span").text(text);
	if(position=='bottom'){
		$(".show_msg").css('bottom','5%');
	}else if(position=='center'){
		$(".show_msg").css('top','');
		$(".show_msg").css('bottom','50%');
	}else{
		$(".show_msg").css('bottom','95%');
	}
	$('.show_msg').hide();
	$('.show_msg').fadeIn(2000);
	$('.show_msg').fadeOut(1000);
}

        //昵称,真实姓名,QQ号
        function checkExtendfields() {
            if ($.trim($("#mobile").val()).length <= 0) {
                showMsg("请填写手机号码！账户出现问题时及时联系您","center");
                return false;
            }
            if ($.trim($("#realname").val()).length <= 0) {
                showMsg("请填写真实姓名方便我们技术人员联系您","center");
                return false;
            }
            return true;
        }
        //检查密码
        function checkPassword() {
            var value = $('#password').val();
            var strRegex = /^[0-9a-zA-Z_]{1,}$/;
            if (value.length >= 6 && value.length <= 20) {
                if (strRegex.test(value)) {
                    return true;
                }
            } else {
                showMsg('请输入密码，密码长度为6-20个字符',"center");
                return false;
            }
        }
        //检查用户名
        function checkUsername() {
            var value = $('#realname').val();
            var strRegex = /^[\u4e00-\u9fa5_a-zA-Z0-9]+$/;

            if (value.length >= 2 && value.length <= 16) {
                if (strRegex.test(value)) {
                    return true;
                }
            } else {
                showMsg("真实姓名请输入2~16个字符，可使用字母、数字、下划线","center");
                return false;
            }
        }

    (function(doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function() {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth) return;
                clientWidth = clientWidth > 640 ? 640 : clientWidth;
                docEl.style.fontSize = 40 * (clientWidth / 640) + 'px';
            };
        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
        var head=$('.head').height();
        var aa=docEl.clientHeight-"80";
        $('.res_page').height(aa);
    })(document, window);

    $(document).ready(function () {
        var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;

        var wait=60;
        function time() {
            if (wait == 0) {
                $("#getPhoneCode").removeAttr("disabled");
                $("#getPhoneCode").html("获取验证码");
                $("#getPhoneCode").removeClass("ccc");
                wait = 60;
                return;
            } else {
                $("#getPhoneCode").attr("disabled", 'disabled');
                $("#getPhoneCode").html(wait+"s");
                $("#getPhoneCode").addClass("ccc");
                wait--;
            }
            setTimeout(function() {
                    time()
                },
                1000);
        }

        //验证通过发送短信
        $("#getPhoneCode").click(function(){
            var mobile = $("#mobile").val();
            if(mobile=='' || mobile==null){
                showMsg("请输入手机号","center");
                $("#mobile").focus();
                return false;
            }else if(!myreg.test(mobile)){
                // $(".hint").html('请输入正确的手机格式');
                // $(".login-msg").css("display", "block");
                showMsg("请输入正确的手机格式","center");
                $("#mobile").focus();
                return false;
            }else{
                $.ajax({
                    type: "GET",
                    url: "{:__URL('PLATFORM_MAIN/login/checkMobile')}",
                    data: {"mobile":mobile},
                    success: function(data){
                        if(data){
                            // $(".hint").html('该手机号已被注册');
                            // $(".login-msg").css("display", "block");
                            showMsg("该手机号已被注册","center");
                            $("#mobile").focus();
                            return false;
                        }else{
                            $.ajax({
                                type: "POST",
                                url: "{:__URL('PLATFORM_MAIN/login/sendsmsregistercode')}",
                                data: {"mobile": mobile,"captcha":$("#captcha").val()},
                                success: function (data) {
                                    if (data['code'] >0) {
                                        // $(".hint").html(data['message']);
                                        // $(".login-msg").css("display", "block");
                                        
                                        time();
                                        showMsg(data['message'],"center");
                                    } else {
                                        // $(".hint").html(data['message']);
                                        // $(".login-msg").css("display", "block");
                                        showMsg(data['message'],"center");
                                        return false;
                                    }
                                }
                            });
                        }
                    }
                });
                
            }

        })

            $('#submit').click(function () {
                //检查用户名
                //昵称,真实姓名,QQ号
                if(!checkExtendfields()){
                    return;   
                }
                //检查手机号码验证码
                // if(!checkCoe()){
                //     return;
                // }
                //检查密码
                if(!checkPassword()){
                    return;
                }
                if(!checkUsername()){
                    return;
                }
                var mobile = $("#mobile").val();
                var realname = $("#realname").val();
                var password=$("#password").val();
                var telcoe=$("#telcoe").val();
                if(password.length<6){
                    showMsg("密码长度不能小于6位","center");
                    $("#password").focus();
                    return false;
                }
            $.ajax({
                type: "post",
                url: "{:__URL('PLATFORM_MAIN/login/addWebsite')}",
                data: {
                    'shop_name': '',
                    'shop_group_id': '',
                    'user_account': realname,
                    'user_pwd': password,
                    'shop_status': 1,
                    'user_tel': mobile,
                    'is_default':1,
                    'mobile_code':telcoe,
                    'note':'1',
					'ismobile':1
                },
                async: true,
                success: function (data) {
                    if (data["code"] > 0) {
                        location.href = "{:__URL('PLATFORM_MAIN/login/registermobilesuccess')}";
                    } else {
                        showMsg(data['message'],"center");
                        return false;
                    }
                }
            });

            })
    })

</script>
</body>

</html>